/*
* name; teeter主逻辑
*/

class PlayTeeter extends ui.GameMainUI {
    public vx:number = 0;
    public vy:number = 0;

    constructor(){
        super();

        Laya.stage.addChild(this);
        console.log("进入主逻辑");
        // 监视加速器状态
		Accelerator.instance.on(Laya.Event.CHANGE, this, this.monitorAccelerator);
        // 游戏循环
		Laya.timer.frameLoop(1, this, this.animate);
    }

	private monitorAccelerator(acceleration:AccelerationInfo, accelerationIncludingGravity:AccelerationInfo, rotationRate:Object, interval:Number):void
	{
		this.vx = accelerationIncludingGravity.x;
		this.vy = accelerationIncludingGravity.y;
	}

    private animate():void{
        this.text_label.text = "重力值v1.0.1    " + this.vx + "  \n" + this.vy;
    }
}